package com.wsfk.ssm.action;

import java.io.File;
import java.util.List;

import javax.annotation.Resource;

import org.apache.struts2.ServletActionContext;
import org.springframework.stereotype.Controller;

import com.wsfk.ssm.entity.HandBook;
import com.wsfk.ssm.entity.User;
import com.wsfk.ssm.service.TempImageSvc;
import com.wsfk.ssm.tools.BaseAction;

@Controller("ShareManualAction")
public class ShareManualAction  extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 428723660394593344L;
	
	public TempImageSvc tempImageSvc;
	
	public User user;
	public HandBook handBook;
	public File imageFile;
	public List<String> orders;
	public List<String> imageIds;

	
	
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public HandBook getHandBook() {
		return handBook;
	}
	public void setHandBook(HandBook handBook) {
		this.handBook = handBook;
	}
	public File getImageFile() {
		return imageFile;
	}
	public void setImageFile(File imageFile) {
		this.imageFile = imageFile;
	}
	public List<String> getOrders() {
		return orders;
	}
	public void setOrders(List<String> orders) {
		this.orders = orders;
	}
	public List<String> getImageIds() {
		return imageIds;
	}
	public void setImageIds(List<String> imageIds) {
		this.imageIds = imageIds;
	}
	
	
	
	public TempImageSvc getTempImageSvc() {
		return tempImageSvc;
	}
	@Resource
	public void setTempImageSvc(TempImageSvc tempImageSvc) {
		this.tempImageSvc = tempImageSvc;
	}

	public String bookIcon(){
		String model = ServletActionContext.getServletContext().getRealPath("WEB-INF/model");
		tempImageSvc.saveIcon(user.getId(), handBook.getId(), imageFile, model);
		return "bookicon";
	}
	
	public String readyFile(){
		tempImageSvc.saveReadyFile(user.getId(), handBook.getId(), imageFile);
		return "readyfile";
	}
	
	public String bookBind(){
		tempImageSvc.saveBookBind(user.getId(), handBook, orders, imageIds);
		return "bookbind";
	}
	
	
}
